//
// ForeignKey
//

package net.fauxjobuilder;

public class ForeignKey
{
    // ============================================================
    // Fields
    // ============================================================

    private String _foreignSchemaName;
    private String _columnName;
    private String _foreignTableName;
    private String _foreignColumnName;

    // ============================================================
    // Constructors
    // ============================================================

    public ForeignKey( String foreignSchemaName, String columnName, String foreignTableName,
        String foreignColumnName )
    {
        _foreignSchemaName = foreignSchemaName;
        _columnName = columnName;
        _foreignTableName = foreignTableName;
        _foreignColumnName = foreignColumnName;
    }

    // ============================================================
    // Methods
    // ============================================================

    public String getForeignSchemaName()
    {
        return _foreignSchemaName;
    }

    public void setForeignSchemaName( String schemaName )
    {
        _foreignSchemaName = schemaName;
    }

    public String getColumnName()
    {
        return _columnName;
    }

    public void setColumnName( String columnName )
    {
        _columnName = columnName;
    }

    public String getForeignTableName()
    {
        return _foreignTableName;
    }

    public void setForeignTableName( String foreignTableName )
    {
        _foreignTableName = foreignTableName;
    }

    public String getForeignColumnName()
    {
        return _foreignColumnName;
    }

    public void setForeignColumnName( String foreignColumnName )
    {
        _foreignColumnName = foreignColumnName;
    }

    public String getHashString()
    {
        return _foreignSchemaName + ":" + _columnName + ":" + _foreignTableName + ":" + _foreignColumnName;
    }

    @Override
    public int hashCode()
    {
        return getHashString().hashCode();
    }

    @Override
    public boolean equals( Object other )
    {
        if ( other instanceof ForeignKey )
        {
            return getHashString().equals( ( (ForeignKey)other ).getHashString() );
        }
        return false;
    }
}

